The present invention relates to a method and apparatus for processing primitives in a computer graphics display system. More particularly, the present invention relates to a computer graphics display system operating in accordance with the window coordinate architectural model in which perspective projection is performed in the graphics hardware of the computer graphics display system rather than in the host central processing unit (CPU).
Generally, two architectural models are currently used in the three-dimensional (3-D) computer graphics industry to send graphics primitives to the graphics hardware. One of the architectural models, commonly referred to as the object coordinate, or modeling coordinate, architectural model (hereinafter xe2x80x9cthe object coordinate modelxe2x80x9d) is implemented in computer graphics display systems that are geometry accelerated. In this architectural model, the vertex object coordinates of an application, as well as any optional data, such as normals and colors, are sent directly to the graphics device (e.g., a graphics card) from the host CPU and are completely transformed by the geometry accelerator of the graphics device from object coordinates into device/window coordinates and, optionally, into eye/world coordinates. The geometry accelerator is also responsible for performing perspective projection during the transformation process, as well as for performing additional operations, such as lighting and fog calculations, for example.
The second architectural model is commonly referred to as the window coordinate architectural model (hereinafter xe2x80x9cthe window coordinate modelxe2x80x9d). In typical implementations of this architectural model, the vertex object coordinates associated with an application being executed by the host CPU are transformed by a software geometry processing pipeline being executed in the host CPU into window coordinates. The vertex object coordinates are first transformed into eye coordinates, which are then transformed into clip coordinates. Assuming that perspective projection is needed (i.e., assuming that the image being rendered is 3-D) the clip coordinates are then perspective projected into normalized device coordinates. The normalized device coordinates are then transformed into window coordinates. All of these transformations occur within the host CPU.
Once the host CPU has transformed the vertex object coordinates into window coordinates, and has completed any additional processing tasks, such as the tasks of performing lighting and clipping, the window coordinates and any optional vertex data are sent to the graphics hardware. The graphics hardware then performs vector and triangle setup and scan conversion. A known variation of this approach is to also perform vector and/or triangle setup in the host CPU so that the graphics hardware is only required to perform scan conversion.
In the window coordinate model, it is common, in the non-perspective case, for the clip coordinates to correspond directly to the window coordinates. In this case, the system CPU does not have to perform the tasks of perspective projecting the clip coordinates into normalized device coordinates and then of transforming the normalized device coordinates into window coordinates. However, in the perspective case, the clip coordinates must be perspective projected into normalized device coordinates and then the normalized device coordinates must be transformed into window coordinates, which are additional processing steps that typically involve a divide operation and several multiply operations. These are costly processing steps, particularly the perspective division operation, which must be performed by the host CPU prior to sending the window coordinates to the graphics hardware.
In another known implementation of the window coordinate model, the vertex object coordinates are transformed directly into window clip coordinates which are then perspective projected into window coordinates. Although this approach improves the computational efficiency of the transformation pipeline being executed by the host CPU, these transformations still require a significant amount of processing to be performed in the host CPU.
Some computer graphics display systems which implement the window coordinate model comprise graphics hardware which implements a floating-point cell which comprises a general-purpose divider circuit. This divider circuit is used in some of these systems to perform the tasks of vector and triangle setup. It would be advantageous to use this floating-point cell to perform perspective projection in addition to performing vector and triangle setup. However, current implementations of 3-D graphics application program interfaces (APIs), such as, for example, OpenGL(trademark) designed by Silicon Graphics, Inc. and Direct3D(trademark) designed by Microsoft Corporation, used in window coordinate models for performing transformation in the host CPU present window coordinates to the graphics hardware.
Therefore, the current implementations of these types of graphics APIs, among which OpenGL(trademark) and Direct3D(trademark) are currently the most widely used, do not enable the task of perspective projection to be performed within the graphics hardware, but rather, cause these transformation processes to be performed in the host CPU. Consequently, graphics devices currently available on the market are not adapted to perform the task of perspective projection since this task has historically been performed in the host CPU.
A need exists for a computer graphics display system which operates in accordance with the window coordinate architectural model and which allows the task of perspective projection to be performed in the graphics hardware. It would be particularly advantageous to enable the task of perspective projection to be performed in the above-mentioned floating-point cell currently implemented in the graphics hardware of computer graphics display systems currently available on the market. By off-loading the task of perspective projection from the host CPU to the graphics hardware, increased throughput can be realized and processing overhead can be reduced.
The present invention provides a method and apparatus for processing primitives in a computer graphics display system. The apparatus comprises a graphics device which receives commands and data from a host computer. The data includes clip coordinates which are perspective projected by the graphics device into window coordinates. A host computer of the computer graphics display system is programmed to execute a geometry processing pipeline which transforms object coordinates associated with a primitive into clip coordinates which are then delivered to the graphics device. The graphics device then performs perspective projection on the clip coordinates to transform the clip coordinates into window coordinates.
In accordance with the preferred embodiment of the present invention, the geometry processing pipeline being executed by the host computer transforms the object coordinates into window clip coordinates and then delivers the window clip coordinates to the graphics device. The graphics device then performs perspective projection on the window clip coordinates to transform them into window coordinates. In accordance with an alternative embodiment of the present invention, the geometry processing pipeline being executed in the host computer transforms the object coordinates into eye coordinates and then transforms the eye coordinates into clip coordinates. The clip coordinates are then delivered to the graphics device, which transforms the clip coordinates into window coordinates.
In accordance with the preferred embodiment of the present invention, the graphics device comprises an interface unit and a setup unit. The setup unit is in communication with the interface unit. The setup unit receives commands and data sent by the host computer to the interface unit and the interface unit delivers the clip coordinates to the setup unit. The setup unit comprises a floating point unit which performs perspective projection on the clip coordinates or window clip coordinates to transform them into window coordinates.
The setup unit preferably comprises a control register which contains a plurality of bits which are used by the floating point unit to control its operations. One of the bits is a perspective enable bit which is utilized by the floating point unit to inform the floating point unit as to whether or not perspective projection is to be performed by the floating point unit. In accordance with the preferred embodiment, if the perspective enable bit is asserted, the floating point unit performs perspective projection, and if the perspective enable bit is not asserted, the floating point unit does not perform perspective projection on the clip coordinates.
In some cases, perspective projection may be performed in the host computer. In this case, the host computer will deliver window coordinates to the graphics device and it will be unnecessary for the graphics device to perform perspective projection. Therefore, in this case, the perspective enable bit will not be asserted. In some cases, even though, in accordance with the present invention, the graphics device is configured to perform perspective projection, it may be unnecessary to perform perspective projection at all. In this case, the perspective enable bit will not be asserted. Regardless of whether or not perspective projection is performed, the setup unit will also perform vector and triangle setup, which are operations normally performed by setup units in graphics devices of computer graphics display systems.
Other features and advantages of the present invention will become apparent from the following description, drawings and claims.